package com.manor.paradise.adapter

import android.widget.ImageView
import android.widget.TextView
import com.bumptech.glide.Glide
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.manor.paradise.R
import com.manor.paradise.bean.EmploymentBean

class EmploymentRecordsAdapter(layoutResId: Int, data: MutableList<EmploymentBean.RecordsBean>?) : BaseQuickAdapter<EmploymentBean.RecordsBean, BaseViewHolder>
(layoutResId, data) {

    override fun convert(holder: BaseViewHolder, item: EmploymentBean.RecordsBean) {
        val imAv = holder.getView<ImageView>(R.id.im_av)
        Glide.with(context)
                .load(item.spiritImgUrl)
                .thumbnail(0.1f)
                .into(imAv)

        var tv_name = holder.getView<TextView>(R.id.tv_name);
        tv_name.setText(item.spiritName.toString())
        var tv_hysc = holder.getView<TextView>(R.id.tv_hysc);
        tv_hysc.setText("活跃有效期："+item.activeDays+"天")
        var createTime = holder.getView<TextView>(R.id.tv_createTime);
        createTime.setText("孵出时间："+item.createTime+"")
        var tv_produce = holder.getView<TextView>(R.id.tv_produce);
        tv_produce.setText("米粒产出量："+item.producedCrystalOre.toString()+"个")
        var tv_invalidDate = holder.getView<TextView>(R.id.tv_invalidDate);
        tv_invalidDate.setText("到期时间："+item.invalidDate+"")


    }
    override fun onViewRecycled(holder: BaseViewHolder) {
        super.onViewRecycled(holder)
    }

    override fun onViewAttachedToWindow(holder: BaseViewHolder) {
        super.onViewAttachedToWindow(holder)

    }
}
